{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "613e481c-3817-43be-b14b-acd4431894fb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dy_dx= 23.0\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "x=tf.Variable(5.0)\n",
    "with tf.GradientTape() as tape:\n",
    "    y=2*tf.square(x)+3*x\n",
    "dy_dx=tape.gradient(y,x)\n",
    "print(\"dy_dx=\",dy_dx.numpy())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8fa3685d-a684-4723-8db6-24abd87259bf",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
